﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MainMasterPage.Master" AutoEventWireup="true" CodeBehind="EntryFormLayout.aspx.cs" Inherits="OpenSIS.Student.EntryFormLayout" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

<style type="text/css">
       
     

ul
{
width: 600px;
list-style-type: none;
margin: 0px;
padding: 0px;
}
li
{
float: left;
margin: 0px;
padding: 0px;
width: 300px;
}
li div
{
width:250px;
height: 30px;
text-align: left;
margin: 0px;
}
        
        /*ul
        {
            width: 530px;
            list-style-type: none;
            margin: 0px;
            padding: 0px;
           
        }
        
        .ul
        {
        	width:800px;
            list-style-type: none;
            margin: 0px;
            padding: 5px;
           
        }
        
        li
        {
            float: left; 
            
        }
             
        li div
        {
            
            
            float:left;
           height:30px;
           
        }*/
       
    </style>
 
 <script type="text/javascript" src="../Scripts/jquery-1.3.2.min.js"></script>

    <script type="text/javascript" src="../Scripts/dragsort-0.3.min.js"></script>

    <script src="../Scripts/ui.core.js" type="text/javascript"></script>

    <script src="../Scripts/ui.draggable.js" type="text/javascript"></script>

    <div class="content">        
        <div>
            <div class="blue_large" align="left">
                   <strong> Student Data Entry Form Layout </strong>
            </div>
           
            <div class="addstudent_container">
                <table width="100%" cellpadding="0" cellspacing="0" border="0">
                    
                    <tr>
               
                        <asp:MultiView ID="mvFormLayout" runat="server">
                        <%-----------------------------------------  Dashboard Content  ------------------%>
                            <asp:View ID="viewDashboard" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Dashboard content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <%------------------------------------------------------------------------------------------%>
                            <asp:View ID="viewGeneralInfo" runat="server">
                                <td valign="top">
                                    <table cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td class="viewformtab_top">&nbsp;</td>
                                            <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td align="right" style="max-width: 210px; text-align: right;" class="viewformtab_content">
                                                <div style="z-index: 1; width: 210px; text-align: right;">
                                                    <asp:TreeView ID="tvCategoryList" ExpandDepth="0" runat="server" ShowLines="false"
                                                        LeafNodeStyle-Width="210px" HoverNodeStyle-Width="210px" ParentNodeStyle-Width="210px"
                                                        RootNodeStyle-Width="210px" NodeStyle-Width="210px" SelectedNodeStyle-Width="210px"
                                                        LineImagesFolder="" OnSelectedNodeChanged="tvCategoryList_SelectedNodeChanged">
                                                        <RootNodeStyle CssClass="" />
                                                        <LeafNodeStyle CssClass="viewformtab_leaf" />
                                                        <HoverNodeStyle CssClass="viewformtab" />
                                                        <SelectedNodeStyle CssClass="viewformtab_select" />
                                                        <ParentNodeStyle CssClass="" />
                                                        <NodeStyle />
                                                    </asp:TreeView>
                                                </div>
                                            </td>
                                            <td style="padding:10px;" valign="top" align="left">
                                             
                                           
                                            
                                                <div style="vertical-align: top;" align="left">
                                                <asp:Label ID="lblHeader" runat="server" ></asp:Label>
                                                    <ul id="ul">
                                                        <asp:Repeater ID="rptrFields" runat="server" OnItemDataBound="rptrFields_ItemDataBound">
                                                            <ItemTemplate>
                                                                <li itemid='<%#Eval("FieldId") %>' def_cus='<%#Eval("Default_Custom") %>' id="li"
                                                                    runat="server">
                                                                    <div id="div" align="left" runat="server">
                                                                    
                                                                        <table align="left" cellpadding="0" cellspacing="0">
                                                                            <tr>
                                                                                <td valign="top" align="left">
                                                                                    <div style="width: 130px">
                                                                                        <%# Eval("FieldName")%>
                                                                                    </div>
                                                                                </td>
                                                                                <td  valign="top" class="colon">
                                                                                    :
                                                                                </td>
                                                                                <td valign="top" style="width: 110px" align="right">
                                                                                    <div id="maindiv" runat="server">
                                                                                    </div>
                                                                                </td>
                                                                            </tr>
                                                                        </table>
                                                                    </div>
                                                                    <asp:HiddenField ID="hdnFieldType" runat="server" Value='<%#Eval("FieldType") %>' />
                                                                    <asp:HiddenField ID="hdnFieldId" runat="server" Value='<%#Eval("FieldId") %>' />
                                                                    <asp:HiddenField ID="hdnDefCus" runat="server" Value='<%#Eval("Default_Custom") %>' />
                                                                </li>
                                                            </ItemTemplate>
                                                        </asp:Repeater>
                                                    </ul>

                                                    <script type="text/javascript">

                                                        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                                                        function EndRequestHandler(sender, args) {
                                                            if (args.get_error() == undefined) {
                                                                unload();
                                                            }
                                                        }
                                                        unload();
                                                        function unload() {
                                                          // alert('okkkk');
                                                            $("#ul").dragsort({ dragSelector: "li div", dragEnd: save });
                                                        }

                                                        function save() {

                                                            var fieldid = "";
                                                            var def_cus = "";
                                                            var count = 1;
                                                            var schoolid = document.getElementById('<%=hdnSchoolId.ClientID %>').value;
                                                            var catid = document.getElementById('<%=hdnCatId.ClientID %>').value;

                                                            $("#ul li").each(function (i, elm) {



                                                                fieldid = $(elm).attr("itemID");
                                                                def_cus = $(elm).attr("def_cus");


                                                                $.ajax(

            {

                type: "POST",
                url: "../Class/Services/Coordinates.asmx/SaveOrder",
                data: "{fieldid: '" + fieldid + "', schoolid: '" + schoolid + "', sortorder: '" + count + "', def_cus: '" + def_cus + "', catid: '" + catid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {


                }
            }

            );

                                                                count++;

                                                            });


                                                        }

            



      
		    
                                                    </script>

                                                    <asp:PlaceHolder ID="phAllFieldHolder" runat="server"></asp:PlaceHolder>
                                                </div>
                                                <%--<asp:GridView ID="rlFieldsByCategory" BackColor="Transparent" runat="server" 
                                        GridLines="None" Width="100%" ShowHeader="false" ShowFooter="False" BorderWidth="0"
                                        OnRowDataBound="rlFieldsByCategory_RowDataBound" AutoGenerateColumns="false">
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                                                        <tr>
                                                            <td align="left">
                                                                <asp:Label ID="lblFieldName" runat="server" Text='<%#Eval("FieldName")%>'></asp:Label>
                                                            </td>
                                                            <td align="left">
                                                                <asp:PlaceHolder ID="plStudentDetails" runat="server"></asp:PlaceHolder>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:HiddenField ID="hdnFieldId" runat="server" Value='<%#Eval("FieldId")%>' />
                                                                <asp:HiddenField ID="hdnFieldType" runat="server" Value='<%#Eval("FieldType")%>' />
                                                                <asp:HiddenField ID="hdnDefaultOrCustom" runat="server" Value='<%#Eval("Default_Custom")%>' />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:GridView ID="gvAddressDetails" runat="server" AutoGenerateColumns="false" Width="100%" ShowHeader="false">
                                                                    <Columns>
                                                                        <asp:TemplateField>
                                                                            <ItemTemplate>
                                                                                <table>
                                                                                    <tr>
                                                                                        <td>
                                                                                            <asp:Label ID="lblFieldName" runat="server" Text='<%#Eval("FieldName")%>'></asp:Label>
                                                                                            <asp:PlaceHolder ID="plStudentDetails" runat="server"></asp:PlaceHolder>
                                                                                        </td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                        <td>
                                                                                            <asp:HiddenField ID="hdnFieldId" runat="server" Value='<%#Eval("FieldId")%>' />
                                                                                            <asp:HiddenField ID="hdnFieldType" runat="server" Value='<%#Eval("FieldType")%>' />
                                                                                            <asp:HiddenField ID="hdnDefaultOrCustom" runat="server" Value='<%#Eval("Default_Custom")%>' />
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </td>
                                                        </tr>

                                                    </table>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        
                                    </asp:GridView>--%>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="viewformtab_bot">&nbsp;</td>
                                            <td>&nbsp;</td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <%------------------------------------------------------------------------------------------%>
                            <asp:View ID="viewAttendance" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Attendance content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <asp:View ID="viewSchedule" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Schedule content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <asp:View ID="viewGrades" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Grades content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <asp:View ID="viewEligibility" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Eligibility content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <asp:View ID="viewDiscipline" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Discipline content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            <asp:View ID="viewBilling" runat="server">
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                Billing content goes here....
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </asp:View>
                            
                        </asp:MultiView>
                    </tr>
                </table>
            </div>
        </div>
          
    </div>

<asp:HiddenField ID="hdnSchoolId" runat="server" />
<asp:HiddenField ID="hdnCatId" runat="server" />

</asp:Content>
